import { FieldType } from '@/interface';

export default (projectId:string) :any => ({
  autoQuery: false,
  autoCreate: true,
  paging: false,
  pageSize: 10,
  fields: [
    {
      name: 'id',
      type: 'string' as FieldType,
    },
    {
      name: 'name',
      type: 'string' as FieldType,
    },
    {
      name: 'stageRecordList',
      type: 'onject' as FieldType,
    },
    {
      name: 'trigger',
      type: 'object' as FieldType,

    },
    {
      name: 'status',
      type: 'string' as FieldType,
    },
    {
      name: 'triggerType',
      type: 'string' as FieldType,
    },
    {
      name: 'finishedDate',
      type: 'string' as FieldType,
    },
    {
      name: 'staredDate',
      type: 'string' as FieldType,
    },
  ],
  transport: {
    read: (data:any) => {
      const id = data?.data?.id;
      if (id) {
        return {
          url: `/devops/v1/projects/${projectId}/pipeline_records/${id}`,
          method: 'get',
        };
      }
      return {};
    },
  },
  events: {

  },
});
